package com.creative.accountsdk.net.account;

import com.creative.accountsdk.UmsChannel;
import com.creative.accountsdk.UserData;
import com.creative.accountsdk.net.Protocol;
import com.creative.accountsdk.net.XParams;
import com.loopj.android.http.RequestParams;

import org.json.JSONObject;

/**
 * 绑定第三方平台账号
 * Created by yinjialiang on 15-4-2.
 */
public class ThirdLoginProtocol extends Protocol {
    private int platform;
    private String puid,ptoken,pnickname;

    public JSONObject jsonUser;

    public ThirdLoginProtocol(int platform, String puid, String ptoken, String pnickname)
    {
        this.platform = platform;
        this.puid = puid;
        this.ptoken = ptoken;
        this.pnickname = pnickname;
    }

    @Override
    public RequestParams getParams() {
        XParams params = new XParams()
                .put("plat", platform)
                .put("puid", puid)
                .put("ptoken", ptoken)
                .put("pnickname", pnickname)
                .put(UmsChannel.PARAM_NAME, UmsChannel.getChannel());
        return params.getParams();
    }

    @Override
    public String getUrl() {
        return getUrlPrefix() + "tpacct";
    }

    @Override
    protected void parseReturnMap(JSONObject returnMap) {
        jsonUser = returnMap;
    }
}
